package com.trg.flex.messages
{
	import mx.controls.Text;

	public class MessageRenderer extends Text
	{
		public function MessageRenderer(msg:Message)
		{
			super();
			message = msg;
		}
		
		protected var _message:Message;
		
		public function get message():Message {
			return _message;
		}
		public function set message(msg:Message):void {
			text = msg.text;
			switch (msg.type) {
				case Message.TYPE_ERROR:
					this.styleName = "error"; break;
//					this.setStyle("color","red"); break;
				case Message.TYPE_INFO:
					this.styleName = "info"; break;
//					this.setStyle("color","blue"); break;
				case Message.TYPE_SUCCESS:
					this.styleName = "success"; break;
//					this.setStyle("color","green"); break;
				case Message.TYPE_WARNING:
					this.styleName = "warning"; break;
				default:
					this.styleName = ""; break;
//					this.setStyle("color","black"); break;
			}
		}
		
	}
}